package com.itheima.health.h5.controller;

import com.itheima.health.entity.Result;
import com.itheima.health.pojo.Setmeal;
import com.itheima.health.service.SetmealService;
import com.itheima.health.vo.SetmealVO;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.naming.spi.ResolveResult;
import java.util.List;

@RestController
public class SetmealMobileControler {

    @Reference
    private SetmealService setmealService;

    /**
     * 查询所有套餐
     * @return
     */
    @PostMapping("setmeal/findAllSetmeal")
    public Result findSetmealAll(){
        List<Setmeal> setmealList = setmealService.list();

        return new Result(setmealList);

    }

    @GetMapping("setmeal/findSetMealDetail")
    public Result findSetMealDetail(@RequestParam("id")Integer id){
        SetmealVO setmealVO = setmealService.findSetMealDetail(id);
        return new Result(setmealVO);
    }
    @GetMapping("setmeal/findById")
    public Result findById(@RequestParam("id")Integer id){
        SetmealVO setmealVO = setmealService.findById(id);
        return new Result(setmealVO);
    }
}